#include "signer-amd64.h"
#include <iostream>
#include <string>

int main() {
    char* createClientCStr = CreateClient(
        (char*)"https://mainnet.zklighter.elliot.ai",
        (char*)"0x83b2674ffb6368347311c1227d7a46c33d60d8eeaa55a435515fb2c382c74e2d9daacdde505af43b",
        304, 3, 259519
    );

    if (createClientCStr != nullptr) {
        std::cout << "CreateClient returned: " << createClientCStr << std::endl;
    }

    char* checkClientCStr = CheckClient(3, 259519);
    if (checkClientCStr != nullptr) {
        std::cout << "CheckClient returned: " << checkClientCStr << std::endl;
    }

    // 下单签名
    // StrOrErr signCreateOrderStrOrErr = SignCreateOrder(0,1,50,409000,1,0,1,0,0,-1,-1);
    // if (signCreateOrderStrOrErr.err != nullptr) {
    //     std::cout << "SignCreateOrder error: " << signCreateOrderStrOrErr.err << std::endl;
    // } else {
    //     std::cout << "SignCreateOrder returned: " << signCreateOrderStrOrErr.str << std::endl;
    // }

    // 撤单签名
    StrOrErr signCancelOrderStrOrErr = SignCancelOrder(0,1,-1);
    if (signCancelOrderStrOrErr.err != nullptr) {
        std::cout << "SignCancelOrder error: " << signCancelOrderStrOrErr.err << std::endl;
    } else {
        std::cout << "SignCancelOrder returned: " << signCancelOrderStrOrErr.str << std::endl;
    }

    StrOrErr createAuthTokenStrOrErr =  CreateAuthToken(0);
    if (createAuthTokenStrOrErr.err != nullptr) {
        std::cout << "CreateAuthToken error: " << createAuthTokenStrOrErr.err << std::endl;
    } else {
        std::cout << "CreateAuthToken returned: " << createAuthTokenStrOrErr.str << std::endl;
    }

    return 0;
}
